package com.virtualtrainer_01.dao;

import android.text.format.Time;

import com.virtualtrainer_01.model.Aliment;
import com.virtualtrainer_01.util.NameList;
import com.virtualtrainer_01.model.Food;
import com.virtualtrainer_01.model.Group;
import com.virtualtrainer_01.model.Muscle;
import com.virtualtrainer_01.model.Exercise;
import com.virtualtrainer_01.model.Training;
import com.virtualtrainer_01.model.TrainingDay;

public class PopulateDatabase {
	public NameList<Aliment> alimentList = new NameList<Aliment>();
	public NameList<Food> foodList = new NameList<Food>();
	public NameList<Group> groupList = new NameList<Group>();
	public NameList<Muscle> muscleList = new NameList<Muscle>();
	public NameList<Exercise> exerciseList = new NameList<Exercise>();
	public NameList<Training> trainingList = new NameList<Training>();
	public NameList<TrainingDay> trainingDayList = new NameList<TrainingDay>();

	private void populateAliment() {
		alimentList.add(new Aliment("Morcov", 3.5f, 1000.0f));
		alimentList.add(new Aliment("Ceapa", 2.0f, 1000.0f));
		alimentList.add(new Aliment("Fasole", 6.5f, 1000.0f));
		alimentList.add(new Aliment("Ulei", 6.0f, 1000.0f));
		alimentList.add(new Aliment("Bulion", 9.5f, 1000.0f));
		alimentList.add(new Aliment("Carne", 20.0f, 1000.0f));
		alimentList.add(new Aliment("Rosii", 5.5f, 1000.0f));
		alimentList.add(new Aliment("Marar", 2.0f, 100.0f));
		alimentList.add(new Aliment("Patrunjel", 2.5f, 100.0f));
	}

	private void populateFood() {
		NameList<Aliment> ra = new NameList<Aliment>(); 
		ra.add(alimentList.getElement("Morcov"));
		ra.add(alimentList.getElement("Patrunjel"));
		ra.add(alimentList.getElement("Ulei"));
		ra.add(alimentList.getElement("Bulion"));
		ra.add(alimentList.getElement("Carne"));
		foodList.add(new Food(ra, "Ciorba de gaina", "Se ia, se baga la oala, si se fierbe", 400.0));
	}

	private void populateGroup() {
		groupList.add(new Group("Brat", "Secundar", "descr brat, biceps sau triceps"));																	// text
		groupList.add(new Group("Picioare", "Principal", "descr picioare"));
		groupList.add(new Group("Piept", "Principal", "descr piept"));
		groupList.add(new Group("Spate", "Principal", "descr spate"));
		groupList.add(new Group("Umeri", "Principal", "descr umeri"));		
		groupList.add(new Group("Trapez", "Secundar", "descr trapez"));
		groupList.add(new Group("Abdomen", "Secundar", "abdomen + lombar + lateral"));
	}

	private void populateMuscle() {
		muscleList.add(new Muscle("Biceps", "partea supeioara", (Group) groupList.getElement("Brat")));
		muscleList.add(new Muscle("Triceps", "partea superioara", (Group) groupList.getElement("Brat")));
		muscleList.add(new Muscle("Antebrat", "partea inferioara", (Group) groupList.getElement("Brat")));
		
		muscleList.add(new Muscle("Gambe", "partea inferioara", (Group) groupList.getElement("Picioare")));
		muscleList.add(new Muscle("Coapse", "partea superioara", (Group) groupList.getElement("Picioare")));
		muscleList.add(new Muscle("Fesieri", "partea superioara", (Group) groupList.getElement("Picioare")));
		
		muscleList.add(new Muscle("Pectorali superiori", "superiori", (Group) groupList.getElement("Piept")));
		muscleList.add(new Muscle("Pectorali inferiori", "inferiori", (Group) groupList.getElement("Piept")));
		
		muscleList.add(new Muscle("Dorsali", "superiori", (Group) groupList.getElement("Spate")));
		muscleList.add(new Muscle("Dorsali", "inferiori", (Group) groupList.getElement("Spate")));
		muscleList.add(new Muscle("Lombari", "descr lombari", (Group) groupList.getElement("Spate")));
		
		muscleList.add(new Muscle("Deltoizi", "descr deltoizi", (Group) groupList.getElement("Umeri")));
		
		muscleList.add(new Muscle("Trapez", "descr trapez", (Group) groupList.getElement("Trapez")));
		
		muscleList.add(new Muscle("Abdomen superior", "superioar", (Group) groupList.getElement("Abdomen")));
		muscleList.add(new Muscle("Abdomen inferior", "inferior", (Group) groupList.getElement("Abdomen")));
		muscleList.add(new Muscle("Abdomen lateral", "lateral", (Group) groupList.getElement("Abdomen")));
	}

	private void populateExercise() {
		exerciseList.add(new Exercise("Biceps cu ganterele", "ciocane sau ridicari normale", 50, (Muscle) muscleList.getElement("Biceps"),4,10,1));
		exerciseList.add(new Exercise("Biceps cu bara Z", "ridicari normale", 50, (Muscle) muscleList.getElement("Biceps"),4,10,2));
		exerciseList.add(new Exercise("Biceps cu sfoara la aparat", "ridicari normale, tragere de sfoara", 50, (Muscle) muscleList.getElement("Biceps"),4,10,2));
		exerciseList.add(new Exercise("Biceps cu bara la aparat", "ridicari normale de bara", 50, (Muscle) muscleList.getElement("Biceps"),4,10,1));
		exerciseList.add(new Exercise("Triceps cu bara Z", "ridicari normale de bara", 50, (Muscle) muscleList.getElement("Triceps"),4,10,1));
		exerciseList.add(new Exercise("Triceps cu haltera", "impins din culcat", 50, (Muscle) muscleList.getElement("Triceps"),4,10,2));
		exerciseList.add(new Exercise("Triceps cu ganterele", "ridicari normale cu ganterele", 50, (Muscle) muscleList.getElement("Triceps"),4,10,1));
		exerciseList.add(new Exercise("Antebrat cu gantera", "ridicari normale cu gantera", 50, (Muscle) muscleList.getElement("Antebrat"),4,10,1));
		exerciseList.add(new Exercise("Antebrat cu bara", "ridicari normale cu bara", 50, (Muscle) muscleList.getElement("Antebrat"),4,10,2));
		
		exerciseList.add(new Exercise("Gambe cu haltera", "genoflexiuni", 50, (Muscle) muscleList.getElement("Gambe"),4,10,2));
		exerciseList.add(new Exercise("Gambe la presa", "impingere", 70, (Muscle) muscleList.getElement("Gambe"),4,10,1));
		exerciseList.add(new Exercise("Coapse la presa", "impingeri", 100, (Muscle) muscleList.getElement("Coapse"),4,10,2));
		exerciseList.add(new Exercise("Genoflexiuni", "geno", 100, (Muscle) muscleList.getElement("Coapse"),4,10,1));
		exerciseList.add(new Exercise("Genoflexiuni cu haltera", "geno", 100, (Muscle) muscleList.getElement("Coapse"),4,10,3));
		
		exerciseList.add(new Exercise("Aparat crunch", "crunch", 120, (Muscle) muscleList.getElement("Abdomen superior"),4,10,1));
		exerciseList.add(new Exercise("Crunch inversat", "crunch inversat", 120, (Muscle) muscleList.getElement("Abdomen inferior"),4,10,1));
		exerciseList.add(new Exercise("Crunch oblici", "crunch pentru laterali", 120, (Muscle) muscleList.getElement("Abdomen lateral"),4,10,2));
		exerciseList.add(new Exercise("Abdomen la bara fixa", "abdomen bara", 200, (Muscle) muscleList.getElement("Abdomen inferior"),4,10,3));
		
		exerciseList.add(new Exercise("Impins din culcat cu haltera", "impins piept", 100, (Muscle) muscleList.getElement("Pectorali superiori"),4,10,2));
		exerciseList.add(new Exercise("Impins din inclinat cu haltera", "impins piept", 100, (Muscle) muscleList.getElement("Pectorali superiori"),4,10,2));
		exerciseList.add(new Exercise("Impins din declinat cu haltera", "impins piept", 100, (Muscle) muscleList.getElement("Pectorali inferiori"),4,10,3));
		exerciseList.add(new Exercise("Fluturari cu ganterele", "fluturari piept", 100, (Muscle) muscleList.getElement("Pectorali inferiori"),4,10,3));
		exerciseList.add(new Exercise("Impins la aparat", "impins piept", 90, (Muscle) muscleList.getElement("Pectorali superiori"),4,10,1));
		exerciseList.add(new Exercise("Impins din inclinat la aparat", "impins piept", 90, (Muscle) muscleList.getElement("Pectorali superiori"),4,10,1));
		
		exerciseList.add(new Exercise("Tractiuni la bara fixa", "tractiuni", 100, (Muscle) muscleList.getElement("Dorsali"),4,10,1));
		exerciseList.add(new Exercise("Ramat cu un brat cu gantera", "ramat", 100, (Muscle) muscleList.getElement("Dorsali"),4,10,2));
		exerciseList.add(new Exercise("Aplecari inainte cu haltera", "aplecari", 100, (Muscle) muscleList.getElement("Dorsali"),4,10,1));
		exerciseList.add(new Exercise("Extensia spatelui", "aplecari", 100, (Muscle) muscleList.getElement("Lombari"),4,10,1));
		exerciseList.add(new Exercise("Tractiuni cu bara la aparat", "tractiuni", 100, (Muscle) muscleList.getElement("Dorsali"),4,10,2));		
		
		exerciseList.add(new Exercise("Impins de la ceafa cu haltera", "impins", 100, (Muscle) muscleList.getElement("Deltoizi"),4,10,2));
		exerciseList.add(new Exercise("Impins de la umeri cu gantere", "impins", 100, (Muscle) muscleList.getElement("Deltoizi"),4,10,2));
		exerciseList.add(new Exercise("Ridicari laterale cu gantere", "ridicari", 100, (Muscle) muscleList.getElement("Deltoizi"),4,10,2));
		exerciseList.add(new Exercise("Ridicari prin fata cu gantere", "ridicari", 100, (Muscle) muscleList.getElement("Deltoizi"),4,10,2));
		
		exerciseList.add(new Exercise("Trageri cu haltera", "trageri", 100, (Muscle) muscleList.getElement("Trapez"),4,10,1));
		exerciseList.add(new Exercise("Ridicari din umeri cu gantere", "ridicari", 100, (Muscle) muscleList.getElement("Trapez"),4,10,1));		
	}

	private void populateTraining() {
		NameList<Exercise> re = new NameList<Exercise>();
		NameList<Group> rg = new NameList<Group>();
		NameList<Exercise> re2 = new NameList<Exercise>();
		NameList<Group> rg2 = new NameList<Group>();
		
		re.add(exerciseList.getElement("Biceps cu ganterele"));
		re.add(exerciseList.getElement("Biceps cu bara Z"));
		rg.add(groupList.getElement("Brat"));
		Time time = new Time(Time.getCurrentTimezone());
		time.setToNow();
		trainingList.add(new Training("Tbic1", rg, 120, time, re));
		
		re2.add(exerciseList.getElement("Gambe cu haltera"));
		re2.add(exerciseList.getElement("Coapse la presa"));
		rg2.add(groupList.getElement("Picioare"));
		time.setToNow();
		trainingList.add(new Training("Tpic1", rg2, 100, time, re2));
	}

	private void populateTrainingDay() {
		trainingDayList.add(new TrainingDay((Training) trainingList.getElement("Tbic1"), (Food) foodList.get(0), (Food) foodList.get(0), (Food) foodList.get(0)));
		trainingDayList.add(new TrainingDay((Training) trainingList.getElement("Tpic1"), (Food) foodList.get(0), (Food) foodList.get(0), (Food) foodList.get(0)));
	}

	public void populate() {// Nu trebuie schimbata ordinea apelarii!!! De ce?
							// pt canu avem echeie straina, deci id-urilie
							// nu le luam din baza, ci din listele de mai sus
		populateAliment();
		populateFood();
		populateGroup();
		populateMuscle();
		populateExercise();
		//populateTraining();
		//populateTrainingDay();
	}
}
